@extends("admin.layout.main")

@section("content")

    <style>
        table thead tr th {
            text-align: center
        }

        table tbody tr td {
            text-align: center
        }
    </style>
    <div class="page-header">
        <h1>
            节假日设置
        </h1>
    </div>
    <div class="page-header">
        <form action="{{route('admin.platform.addHoliday')}}" style="text-align: left" method="post" id="form">
            <div class="page-header">
            <h4>填加节假日:</h4>
            </div>
            {{csrf_field()}}
            <label>
                日期：
                <input type="text" id="start_time" name="holiday" value="" required>
            </label>
            <a>
                <button class="btn btn-xs btn-primary">添加</button>
            </a>
        </form>
    </div>


    <!-- div.table-responsive -->

    <!-- div.dataTables_borderWrap -->
    <div>
        <table id="" class="table table-striped table-bordered table-hover">
            <thead>
            <tr>
                <th>id</th>
                <th>不发放工资日期</th>
                <th>添加日期</th>
                <th>添加人</th>
                <th>操作</th>
            </tr>
            </thead>

            <tbody>
            @foreach($data as $v)
            <tr>
                <td>{{ $v->id }}</td>
                <td>{{ $v->holiday }}</td>
                <td>{{ $v->created_at }}</td>
                <td>{{ $v->admin['admin_name']}}</td>
                <td><a class="btn btn-xs btn-danger" data-id="{{ $v->id }}" data-status="2" onclick="confirm_handle('确认删除?',deleted,'',this)">删除</a></td>
            </tr>
            @endforeach
            </tbody>
        </table>
        <div class="pagination pagination-centered">
            {{ $data->appends([])->links('admin.layout.page') }}
        </div>
    </div>
    <link rel="stylesheet" href="/plugins/jedate/jedate.css"/>
    <link rel="stylesheet" href="/plugins/jedate/jedate.css"/>
    <script src="/plugins/jedate/jedate.min.js"></script>
    <script src="{{ config('global.assets_path') }}js/jquery.validate.min.js"></script>
    <script src="{{ config('global.assets_path') }}js/messages_zh.js"></script>
    <script src="/plugins/layui/layui.js"></script>
    <script src="/plugins/layui/layui_component.js"></script>
    <script src="/js/ajax.js"></script>
    <script>
        var start = {
            dateCell: "#start_time",
            format: "YYYY-MM-DD",
            isinitVal: false,
            isTime: false, //isClear:false,
            maxDate: "2100-01-01",
            minDate: "2018-03-01",
            festival:true,
            choosefun: function (datas) {
                end.minDate = datas;
                $("input[name='begin']").val(datas);
            }
        };
        jeDate(start);
        function deleted(obj) {
            var id = $(obj).data('id');
            ajaxRequest({"id":id},'{{ route('admin.platform.delHoliday') }}','POST');
        }
    </script>
@endsection